home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 14526 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.7 KB

  1. Path: ix.netcom.com!news
  2. From: jlilley@ix.netcom.com (John Lilley)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: C++ experts only
  5. Date: 31 Mar 1996 00:17:14 GMT
  6. Organization: Netcom
  7. Message-ID: <4jkiua$pki@dfw-ixnews1.ix.netcom.com>
  8. References: <4jhrb4$gk2@melon.myna.com>
  9. NNTP-Posting-Host: den-co11-11.ix.netcom.com
  10. Mime-Version: 1.0
  11. Content-Type: Text/Plain; charset=US-ASCII
  12. X-NETCOM-Date: Sat Mar 30  6:17:14 PM CST 1996
  13. X-Newsreader: WinVN 0.99.7
  14.  
  15. In article <4jhrb4$gk2@melon.myna.com>, ckhan@myna.com says...
  16. >
  17. >If you are such an expert, tell me why C++ is so great or not so great as 
  18. >compared to Structured C.
  19.  
  20. Golly, such an attitude...  But it DID get an answer...
  21.  
  22. One could be glib and claim that there are NO disadvantages to C++ vs C because 
  23. C++ is a superset of C, but I don't that it what our dear friend is asking.
  24.  
  25. One could also claim that C++ or any language is no better than the most 
  26. primitive assembler because they are all (within resource limits), 
  27. Turing-machine equivalent, but that is not the answer either, I fear.
  28.  
  29. I assert that C++ is an improvement over C because:
  30.  
  31. 1) It's type system and the safety guarantees therein are more complete and 
  32. allows one to write more reliable code.
  33.  
  34. 2) It is more powerful and requires less typing and other such tedium to 
  35. express groupings of data and operations on data as classes instead of data 
  36. structures and functions.
  37.  
  38. 3) C++ provides a uniform framework of object creation and destruction 
  39. regardless of the physical location (stack, heap or global).  That uniform 
  40. treatment reduces the number of loose ends that crop up when using objects that 
  41. have various lifetimes.
  42.  
  43. 4) Inheritance and the polymorphism supported by virtual methods are powerful 
  44. constructs that reduce the amount of tedium and/or type-violations that are 
  45. needed to express operations upon similar classes of objects.
  46.  
  47. 5) Templates are great IMHO, because they allow one to write a type-safe 
  48. container once and use it for many objects (although at the possible expense of 
  49. code size).
  50.  
  51. 6) Type-safe linkage reduces stupid errors due to mismatching of headers.
  52.  
  53. 7) Overridable new/delete allow one to alter the behavior of memory allocation 
  54. in a systematic manner.
  55.  
  56. 8) Method/function inlining is as efficient as macros (in most cases), but does 
  57. not suffer the semantic and syntactic nasty side-effects of macros.
  58.  
  59. 9) Method inlining for access to data members is as efficient as a simple 
  60. pointer-indirection, but allows for access protection or future upgrades to the 
  61. access that are more complex than pointer-indirection.
  62.  
  63. But this is all stuff you could have read in any intro to C++ book.  I think 
  64. that the reasons are compelling -- why not go buy some books and check it out 
  65. for yourself?
  66.  
  67. john lilley
  68.  
  69.